package com.liangtian.mdm.base.controller;

import com.liangtian.mdm.base.utils.ResultObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

/**
 * <p>Encoding    :  UTF-8</p>
 * <p>Package Name: com.liangtian.mdm.system.controller </p>
 * <p>Project Name: dm </p>
 * <p>Copyright   :  Copyright(c) 2016 石化盈科信息技术有限责任公司 </p>
 * <p>Created Time: 2016-05-04 11:36</p>
 * <p>Description :  上传文件控制器</p>
 *
 * @author : beamzhang
 * @version :  1.0
 */
@Controller
public class UploadController {

    /**
     * 上传图片
     *
     * @param request
     * @param file
     */
    @RequestMapping(value = "/upload/file/img", method = RequestMethod.POST)
    @ResponseBody
    public ResultObject uploadImg(MultipartHttpServletRequest request,
                                  @RequestParam(value = "file") MultipartFile file) throws Exception {
        ResultObject result = new ResultObject();
//         String fileName = FastDFSUploadUtils.uploadFile(file);
        String fileName = "temp";
        result.setData(fileName);
        return result;
    }
}
